package com.kk.demo.unsface.two.unsafelist;

public class MycatRecord implements Comparable<MycatRecord> {

    public int id;
    public int col1;
    public short col2;

    public MycatRecord() {
    }

    public MycatRecord(int id, int col1) {
        super();
        this.id = id;
        this.col1 = col1;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getCol1() {
        return col1;
    }

    public void setCol1(int col1) {
        this.col1 = col1;
    }

    public short getCol2() {
        return col2;
    }

    public void setCol2(short col2) {
        this.col2 = col2;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("[id=");
        builder.append(id);
        builder.append(", col1=");
        builder.append(col1);
        builder.append(", col2=");
        builder.append(col2);
        builder.append("]");
        return builder.toString();
    }

    @Override
    public int compareTo(MycatRecord o) {
        if (this.col1 < o.col1) {
            return 1;
        }

        else if (this.col1 > o.col1) {
            return -1;
        }

        return 0;
    }

}
